import { createRouter, createWebHistory } from 'vue-router'

//导入组件
import LoginVue from '@/views/Login.vue'
import LayoutVue from '@/views/Layout.vue'

import ColumnManageVue from '@/views/column/ColumnManageVue.vue'
import ArticleManageVue from '@/views/article/ArticleManage.vue'
import AvatarVue from '@/views/admin/Avatar.vue'
import AdminInfoVue from '@/views/admin/AdminInfo.vue'
import AdminResetPasswordVue from '@/views/admin/AdminResetPassword.vue'
import RoleManageVue from '@/views/admin/RoleManage.vue'
import LogManageVue from '@/views/log/LogManage.vue'

//定义路由关系
const routes = [
    //输入地址直接跳到后台登录页面
    { path:'/',redirect: '/login'},
    { path: '/login',meta: { title: '管理端登录' }, component: LoginVue },
    {
        path: '/layout', 
        component: LayoutVue, 
        meta: { title: '济南美术馆-济南画院-管理端' },
        children: [
            { path: '/column/manage', component: ColumnManageVue },
            { path: '/article/manage', component: ArticleManageVue },
            { path: '/admin/info', component: AdminInfoVue },
            { path: '/admin/avatar', component: AvatarVue },
            { path: '/admin/resetPassword', component: AdminResetPasswordVue },
            { path: '/admin/role', component: RoleManageVue },
            { path: '/log/manage', component: LogManageVue }
        ],
        redirect:'/column/manage'
    }
]

//创建路由器
const router = createRouter({
    history: createWebHistory(),
    routes: routes
})

//导出路由
export default router
